<?php
namespace app\common\lib;

use think\worker\Server;
use think\facade\Cache;

class Workerman extends Server
{
	protected $socket = 'http://0.0.0.0:2345';

	public function onConnect($connection) {
		// $connection->send('连接 success');
	}

	public function onMessage($connection,$data)
	{	
		// Cache::set('admin', 12);
		$str = Cache::get('admin');
		$message = $connection->toArray();
		
		// var_dump($connection['00000000757bcace000000004becd4c1']);
		// $connection->send(json_encode($connection->toArray(), true));
		$connection->send(json_encode('123', true));
	}
}
